package UMC.Web.UI;


import UMC.Web.UICell;
import UMC.Web.UIClick;
import UMC.Web.WebMeta;

import java.util.LinkedList;
import java.util.List;

public class UISlider extends UICell {
    List<WebMeta> items = new LinkedList<>();

    public int size() {
        return items.size();
    }

    public UISlider() {
        super();
        this.data.put("data", items);
    }
    public UISlider(boolean auto)
    {
        this();
        if (auto)
        {
            this.data.put("auto", true);
        }
    }

    public UISlider row() {
        this.data.put("type", "Row");
        return this;
    }

    public UISlider small() {
        this.data.put("type", "Small");
        return this;
    }

    public UISlider square() {
        this.data.put("type", "Square");
        return this;
    }

    WebMeta data = new WebMeta();


    public UISlider add(String src) {
        items.add(new WebMeta("src", src));
        return this;
    }

    public UISlider add(String src, String video) {
        this.items.add(new WebMeta().put("src", src).put("video-src", video));
        return this;
    }


    public UISlider add(UIClick click, String src) {
        items.add(new WebMeta("src", src).put("click", click));
        return this;
    }

    public UISlider add(UIClick click) {
        items.add(new WebMeta().put("click", click));
        return this;
    }


    @Override
     public WebMeta data() {
        return data;
    }

    @Override
    public String type() {
        return "Slider";
    }
}